package com.sinosoft.antiques.common;

import com.sinosoft.commontools.record.Record;

public class Common {
	// 各个相关系统
	public static String ROWS = "rows";
	public static String TOTAL = "total";
	public static String ReqStatusName = "status";
	public static String ReqDataName = "data";
	public static String ReqErrorName = "error";
	public static String ReqOK = "ok";
	public static String ReqFailed = "failed";
	public static String UserReqStatusName = ReqStatusName;// "resultcode";
	public static String UserReqDataName = ReqDataName;// "resultdata";
	public static String UserReqErrorName = ReqErrorName;
	public static String UserReqOK = ReqOK;// "1";

	public static String hasList = "hasList";
	public static String theList = "list";
	public static String theMsg = "msg";

	public static Record WrapperResult(Record result) {
		Record re = new Record();
		String status = result.getStrValue(Common.UserReqStatusName);
		if (status.equals(Common.UserReqOK)) {
			re.add(Common.ReqStatusName, Common.ReqOK);
			re.add(Common.ReqDataName, result.getValue(Common.UserReqDataName));
		} else {
			re.add(Common.ReqStatusName, Common.ReqFailed);
			re.add(Common.ReqErrorName,
					result.getValue(Common.UserReqErrorName));
		}
		return re;
	}

}
